from random import randint
from time import time, sleep


def download_task(fileName):
    print('开始下载%s...' % fileName)
    time_to_download = randint(5, 10)
    sleep(time_to_download)
    print('%s下载完成，耗费了%d的时间' % (fileName, time_to_download))


def main():
    start = time()
    download_task('python从入门到吃土')
    download_task('Peking Hot.avi')
    end = time()
    print('一共耗时%.2f' % (end - start))


if __name__ == "__main__":
    main()